﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="TestGrafic.aspx.cs" Inherits="TestGrafic" %>
<%@ Register TagPrefix="ajax" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit"%>


<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
    <style type="text/css">	
        .transp{
            background-color: transparent;
            border: none;
        }
        .miniText{
            font-size: 11px;
            text-transform:uppercase;
            }
    </style>
    <script type="text/javascript" src="../scripts/developer.js"></script>
    <script type="text/javascript" src="../scripts/Financial.js"></script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">

    <asp:UpdatePanel ID="previewUpdatePanel" runat="server">
        <ContentTemplate>
            <div class="miniText">

            <div style="float:left; width:150px;">
                Suma:<br />
                <asp:TextBox ID="contractAmountTextBox" runat="server" Width="90%" CssClass="miniText" ></asp:TextBox>
                <asp:RequiredFieldValidator ID="contractAmountTextBoxRequiredFieldValidator" runat="server" ErrorMessage="Intoruceti va rog suma!" ControlToValidate="contractAmountTextBox" Display="None"></asp:RequiredFieldValidator>
                <ajax:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender2"  TargetControlID="contractAmountTextBoxRequiredFieldValidator" />   
            </div>

            <div style="float:left; width:100px;" >                           
                Termen (luni)<br />
                <asp:TextBox ID="loanNrOfMonthsTextBox" runat="server" Width="90%" CssClass="miniText" ></asp:TextBox> 
                <asp:RequiredFieldValidator ID="loanNrOfMonthsTextBoxRequiredFieldValidator" runat="server" ErrorMessage="Intoruceti nr. de luni!" ControlToValidate="loanNrOfMonthsTextBox" Display="None"></asp:RequiredFieldValidator>
                <ajax:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender3"  TargetControlID="loanNrOfMonthsTextBoxRequiredFieldValidator" />  
            </div>

            <div style="float:left; width:60px;" >
                Dobinda<br />
                <asp:TextBox ID="contractPercentTextBox" runat="server" Width="90%" CssClass="miniText"></asp:TextBox>
                <asp:RequiredFieldValidator ID="contractPercentTextBoxRequiredFieldValidator" runat="server" ErrorMessage="Intoruceti procentul!" ControlToValidate="contractPercentTextBox" Display="None"></asp:RequiredFieldValidator>
                <ajax:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender5"  TargetControlID="contractPercentTextBoxRequiredFieldValidator" />         
            </div> 
            <div style="float:left; width:60px;" >
                <br />
                <asp:TextBox ID="alternativePercentTextBox" runat="server" Width="90%" CssClass="miniText"></asp:TextBox>
            </div> 

            <div style="float:left; width:120px;">
                <asp:RadioButton ID="calculateDinSoldInitialRadioButton" runat="server" Text="Sold initial" TextAlign="Right" Checked="true" GroupName="modeCalc" AutoPostBack="true" OnCheckedChanged="calculateDinSoldInitialRadioButton_CheckedChanged" />
                <br />
                <asp:RadioButton ID="calculateDinSoldRamasRadioButton" runat="server"  Text="Soldul ramas" TextAlign="Right" Checked="false" GroupName="modeCalc" AutoPostBack="true" OnCheckedChanged="calculateDinSoldInitialRadioButton_CheckedChanged"  />             
            </div>  
            <div style="float:left;">
                <br />
                <input id="printStartUpFormButton" type="button" value="Print" onclick="doPost('UpdateBeforPrint', '');" />
            </div>

            <div class="clear"></div>

            <div style="float:left; width:100px;">
                Data eliberarii<br />
                <asp:TextBox ID="loandDataEliberariiTextBox" runat="server"  Width="90%" CssClass="miniText" ></asp:TextBox>  
                <ajax:CalendarExtender ID="loanStartDateCalendarExtender" runat="server" TargetControlID="loandDataEliberariiTextBox" ></ajax:CalendarExtender>
                <asp:RequiredFieldValidator ID="loandDataEliberariiRequiredFieldValidator" runat="server" ErrorMessage="Intoruceti data!" ControlToValidate="loandDataEliberariiTextBox" Display="None"></asp:RequiredFieldValidator>
                <ajax:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender1"  TargetControlID="loandDataEliberariiRequiredFieldValidator" />          
            </div>

            <div style="float:left; width:100px;">
                Data Scadentei<br />
                <asp:TextBox ID="loanDataScadenteiTextBox" runat="server"  Width="90%" CssClass="miniText"  ></asp:TextBox>                  
            </div>
                       
            <div style="float:left; width:120px;">
                Valuta ref.:<br />
                <asp:DropDownList ID="currencyDDL" runat="server" Width="90%" CssClass="miniText"  AutoPostBack="true" OnSelectedIndexChanged="currencyDDL_SelectedIndexChanged" ></asp:DropDownList>
            </div>
            <div style="float:left; width:60px;">
                Rata:<br />
                <asp:TextBox ID="currencyChangeRateTextBox" runat="server"  Width="90%" CssClass="miniText"  ></asp:TextBox> 
            </div>                    
            <div style="float:left; width:80px;">
                <br />
                <asp:Button ID="checkRateButton" runat="server" Text="Verifica"  onclick="checkRateButton_Click" Width="80px" CausesValidation="false" Height="19px"   />  
            </div>          
            <div style="float:left; width:70px;"> 
                Plati la <br />  
                <asp:DropDownList ID="payPeriodDDL" runat="server" CssClass="miniText" Width="90%" Enabled="false" ></asp:DropDownList>
            </div>     

            <div style="float:left; width:150px; " >
                <br />
                <asp:Button ID="previewLoanButton" runat="server" Text="Grafic de achitari"  onclick="previewLoanButton_Click" Width="150px"  Height="19px"   />  
            </div>

            
                
            <div class="clear"></div>

  
            <br />
            <div id="PreviewCreditForm" runat="server" style="width:100%;" visible="false" >
                <div class="HiddenColumn">
                    <div style="text-align:center; text-transform:uppercase; margin-bottom:10px; ">
                        Graficul de achitare a imprumuturlui
                    </div>

                    <div style="width:48%; float:left; ">
                        <asp:Label ID="label1" runat="server" Text="Suma imprumutului, lei:" Width="59%" style="text-align:right; "></asp:Label>
                        <asp:Label ID="loanAmountLabel" runat="server" Width="39%" style="text-align:left;"></asp:Label>
                        <br />
                        <asp:Label ID="label2" runat="server" Text="Rata anuala a dobinzii, %:" Width="59%" style="text-align:right;"></asp:Label>
                        <asp:Label ID="loanPercetLabel" runat="server" Width="39%" style="text-align:left;"></asp:Label>
                        <br />
                        <asp:Label ID="label3" runat="server" Text="Metoda de calcul a dobinzii:" Width="59%" style="text-align:right;"></asp:Label>
                        <asp:Label ID="loanCalculationMetodLabel" runat="server" Width="39%" style="text-align:left;"></asp:Label>
                        <br />
                        <asp:Label ID="label4" runat="server" Text="Suma imprumutului, USD:" Width="59%" style="text-align:right;"></asp:Label>
                        <asp:Label ID="loanAmountInUSDLabel" runat="server" Width="39%" style="text-align:left;"></asp:Label>
                    </div>

                    <div style="width:48%; float:left; ">
                        <asp:Label ID="label5" runat="server" Text="Data acordarii:" Width="49%" style="text-align:right;"></asp:Label>
                        <asp:Label ID="loanStartDateLabel" runat="server" Width="49%" style="text-align:left;"></asp:Label>
                        <br />
                        <asp:Label ID="label7" runat="server" Text="Nr. de transe:" Width="49%" style="text-align:right;"></asp:Label>
                        <asp:Label ID="loanNrOfPaymnetsLabel" runat="server" Width="49%" style="text-align:left;"></asp:Label>
                        <br />                    
                        <br />
                        <asp:Label ID="currencyLabel" runat="server" Text="Cursul Dolarului:" Width="49%" style="text-align:right;"></asp:Label>
                        <asp:Label ID="currencyChangeRatelabel" runat="server" Width="49%" style="text-align:left;"></asp:Label>
                    </div>
                    <div style="padding-bottom:80px;"></div>
                </div>                
                <br />

                <asp:Gridview ID="manualEditCreditGridView" 
                    runat="server" 
                    ShowFooter="true" 
                    AutoGenerateColumns="false" 
                    onrowdeleting="manualEditCreditGridView_RowDeleting" >
                    <Columns>      
                        <asp:TemplateField HeaderText="Nr.">
                            <ItemTemplate>
                                <asp:Label ID="nrLabel" runat="server" Text=""></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                          
                        <asp:TemplateField HeaderText="Data">
                            <ItemTemplate>
                                <asp:TextBox ID="manualEditCreditDataTextBox" runat="server" Width="80px" Style="background-color: transparent; border: none;  text-align:center;"></asp:TextBox>
                                <ajax:CalendarExtender ID="CalendarExtender333" runat="server"  TargetControlID="manualEditCreditDataTextBox" Format="<%# Constants.Constants.ISODateBackwardDotsFormat %>" />
                            </ItemTemplate>
                            <FooterTemplate>
                                <asp:Button ID="manualEditCreditButtonAdd" runat="server" Text="Add new" OnClick="manualEditCreditButtonAdd_Click" />
                            </FooterTemplate>
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="Zile" FooterStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">     
                            <ItemTemplate>
                                 <asp:TextBox ID="daysLabel" runat="server" Width="80px" Style="background-color: transparent; border: none;  text-align:center;"></asp:TextBox>
                            </ItemTemplate>      
                            <FooterTemplate>   
                                <asp:Label ID="totalDaysLabel" runat="server" Text="Total" CssClass="tableFooter"></asp:Label>
                            </FooterTemplate>                      
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="Suma Ramasa">
                            <ItemTemplate>
                                <asp:TextBox ID="manualEditCreditRemainingAmountTextBox" runat="server" Width="100px" Style="background-color: transparent; border: none; text-align:right;"></asp:TextBox>                 
                            </ItemTemplate>
                        </asp:TemplateField>  
                        
                        <asp:TemplateField HeaderText="Rata Imprumutului" FooterStyle-HorizontalAlign="Right">
                            <ItemTemplate>
                                <asp:TextBox ID="manualEditMainRateTextBox" runat="server" Width="100px" Style="background-color: transparent; border: none; text-align:right;"></asp:TextBox>
                                <asp:HiddenField ID="manualEditMainRateModifiedHiddenField" runat="server" />
                            </ItemTemplate>
                            <FooterTemplate>   
                                <asp:Label ID="manualEditCreditTotalmainRateLabel" runat="server" Text="Total" CssClass="tableFooter"></asp:Label>
                            </FooterTemplate>
                        </asp:TemplateField> 


                        <asp:TemplateField HeaderText="Dobinda" FooterStyle-HorizontalAlign="Right">
                            <ItemTemplate>
                                <asp:TextBox ID="percentTextBox" runat="server" Width="100px" Style="background-color: transparent; border: none; text-align:right;"></asp:TextBox>
                            </ItemTemplate>
                            <FooterTemplate>                  
                                <asp:Label ID="manualEditCreditTotalProcetLabel" runat="server" Text="Total" CssClass="tableFooter"></asp:Label>
                            </FooterTemplate>
                        </asp:TemplateField>
                                                                            
                        <asp:TemplateField HeaderText="Suma Totala" FooterStyle-HorizontalAlign="Right">
                            <ItemTemplate>
                                <asp:TextBox ID="manualEditCreditTotalAmountTextBox" runat="server" Width="100px" Style="background-color: transparent; border: none; text-align:right;"></asp:TextBox>                 
                            </ItemTemplate>
                            <FooterTemplate>                  
                                <asp:Label ID="manualEditCreditTotalAmountLabel" runat="server" Text="Total" CssClass="tableFooter"></asp:Label>
                            </FooterTemplate>
                        </asp:TemplateField>   

                        <asp:TemplateField HeaderText="Total spre plata, USD" FooterStyle-HorizontalAlign="Right">
                            <ItemTemplate>
                                <asp:TextBox ID="manualEditCreditTotalAmount_RatedTextBox" runat="server" Width="100px" Style="background-color: transparent; border: none; text-align:right;"></asp:TextBox>                 
                            </ItemTemplate>
                            <FooterTemplate>                  
                                <asp:Label ID="manualEditCreditTotalTotalAmount_RatedLabel" runat="server" Text="Total" CssClass="tableFooter" ></asp:Label>
                            </FooterTemplate>
                        </asp:TemplateField> 

                        <asp:TemplateField HeaderText="Delete">
                            <ItemTemplate>
                                <asp:Button ID="manualEditCreditDeleteButton" runat="server" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Sunteti sigur ca vreti sa stergeti?');" />
                            </ItemTemplate>
                        </asp:TemplateField>   
                    </Columns>
                </asp:Gridview>
               
            </div>

            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    

</asp:Content>

